function main() {
    //程序入口
    require(["pluginAttach", "knockout", "plugins/Selector"], function (
        pluginAttach,
        ko,
        Selector
    ) {
        function generateList(count) {
            let list = ko.observableArray([]);
            for (let i = 1; i <= count; i++) {
                list.push({
                    text: "item " + i,
                });
            }
            return list;
        }

        let selector = new Selector(generateList(20));

        let viewModel = {
            selector: selector,
            handleSelectedAllClick: function () {
                selector.selectAll();
            },
            handleUnselectAllClick: function () {
                selector.unselectAll();
            },
            handleInvertSelectClick: function () {
                selector.invertSelect();
            },
        };

        ko.applyBindings(viewModel, document.getElementById("root"));
    });
}
require(["../scripts/require.config"], main);
